home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD School House 10
/
CD School House - Education and Games (10.0) - Wayzata Technology (1995).iso
/
mac
/
DOS
/
MATH
/
MAFIA2A
/
PCALC.HLP
< prev
next >
Wrap
Text File
|
1992-10-01
|
4KB
|
147 lines
╔═════════════════════════════════════════╗ (C) Copyright 1986-1990
║ PCALC.EXE - The Programable Calculator ║ Zvi Shippony
╚═════════════════════════════════════════╝ (818) 990-0134
This Programable Calculator is very simple to use. At the command line
you can enter few instructions (separated by ; ). To end input, hit ENTER
Example:
x=1;y=sin(x);print 'For X ='x;print 'SIN(X)='y
run
This will produce the following output:
For X =1.00000000000000E+00 SIN(X)=8.41470984807897E-01
As you can see, a simple language is being used to compute the desired
results. The language consists of the following commands:
$$$
1. Programing commands:
(Any of the following commands could be preceded by a label. A label is
any 6-char string followed by (:) E.G., label1: Var = expression )
Var = number ( Var is any string, first letter not a digit and
it could be dimensioned,e.g., X(2,3) or A(1,1,1)
** Note: The string: 'PI' is a reserved name !
Var = expression
goto label ( label is any string up to 6 char.)
if Var1 op Var2 goto label (where op in [ < <= > >= = <> ]
and Var2 can be a number as well. )
print var
print 'ANY STRING' var ( String must be enclosed with quotes)
$$$
2. Files commands:
Save Filename - To save the program now in core into a file
Load Filename - To load a program from a file into core
Edit - To edit program now in core
Run - To run the program now in core
$$$
The functions available for programming are:
--------------------------------------------
ABS, INT, EXP, SIN, COS, TAN, COT, LOG, LN, FACT (Factorial) , SQRT
SINH, COSH, TANH, ARCSIN, ARCCOS, ARCTAN, ARCSINH, ARCCOSH, ARCTANH
Expression is any leagal combination of +,-,*,/,**,(,), Variables names,
the above functions and Pi ( = 3.1415926536 ).
$$$
A SIMPLE PROGRAM TO FIND THE SQUARE ROOT OF A NUMBER:
-----------------------------------------------------
Suppose we want to compute the sqrt of 34 using an iterative algorithm
(Newton's). At the command mode, enter the following instructions:
x=1;i=0;a=34;max=20;eps=1.0e-11
cont:y=(x+a/x)/2.;d=abs(x-y);x=y;i=i+1
if i>max goto finish;if d>eps goto cont
finish:print y;print a;print i;print d
x=sqrt(a);d=abs(x-y);print 'real solution:'x;print 'diff.'d
run
The results will look like:
Y: 5.8309518948E+00
A: 3.4000000000E+01
I: 8.0000000000E+00
D: 0.0000000000E+00
REAL SOLUTION: 5.8309518948E+00
DIFF. 0.0000000000E+00
$$$
Obviously, you can enter simple exepressions just to compute things
for example:
x=sqrt(34);print 'sqrt of 34 is:'x;run
And the results will show as:
SQRT OF 34 IS: 5.8309518948E+00
$$$
SAVING /LOADING PROGRAMS:
-------------------------
Suppose we want to save the above code in a file name: test, then run
it. do:
x=1;i=0;a=34;max=20;eps=1.0e-11
cont:y=(x+a/x)/2.;d=abs(x-y);x=y;i=i+1
if i>max goto finish;if d>eps goto cont
finish:print y;print a;print i;print d
x=sqrt(a);d=abs(x-y);print 'real solution:'x;print 'diff.'d
save test
run
$$$
EDITING PROGRAMS:
-----------------
1. Change code:
Suppose we want to change max. number of iterations allowed (max)
and then re-run it. do:
load test
edit
< Hit ENTER until the line: MAX=20 appears, retype it as:>
max=30
end < to indicate end of editing, and then ..>
run
$$$
2. Delete code:
Suppose we want to delete the command: print a do:
load test
edit
< Hit ENTER until the line: PRINT A appears, then do:>
d
end < to indicate end of editing, and then ..>
run
$$$
3. Insert new code:
Suppose we want to print the result (x) for each iteration, so we have
to insert a print command before the first IF test, right after the
command: i=i+1 , do:
load test
edit
< Hit ENTER until the line: I=I+1 appears, then do:>
i
print 'intermidiate result, x = 'x
end < to indicate end of editing, and then ..>
run